package LeetCode;

import java.util.HashSet;

//
// Created by ✎﹏ℳ๓独赏☆独醉 on 2024/6/18.
// 
public class 存在重复的元素 {
    public static void main(String[] args) {

    }
    public boolean containsDuplicate(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        for (int num : nums) {
            if (!set.add(num)) {
                return true;
            }
        }
        return false;
    }
}
